package dao.v2;

import java.util.List;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import model.AwardVO;
import model.CityVO;
import model.LogEarnVO;
import model.LogTicketVO;
import model.MemberTicketVO;
import model.MemberVO;

public interface SplitVOMapper {
	
	String getParentIds(String member_id);
	
	void insertTiketInLog(@Param("member_id")String member_id, @Param("num")String num, @Param("buy_rate")String buy_rate, @Param("pay_type")String pay_type);
	
	void insertCashOutLog6(@Param("member_id") String member_id, @Param("num")String num, @Param("buy_rate")String buy_rate, @Param("price")String price, @Param("pay_type")String pay_type);
	
	void insertCashOutLog5(@Param("member_id")String member_id, @Param("price")String price, @Param("order_id") String order_id, @Param("pay_type")String pay_type);

	void insertBuyCashOutLog(@Param("member_id")String member_id, @Param("order_id") String order_id,@Param("buy_cash")  String buy_cash);
	
	String getJoinAwardFitMember(@Param("member_id")String id,@Param("common_level") String common_level  );
	
	void insertCashInAwardLogJoin(@Param("member_id")String id, @Param("award_id")String award_id, @Param("join_cash")String join_cash
			, @Param("buy_id")String buy_id,  @Param("order_id") String order_id,@Param("type")  int type, @Param("country") String country);
	
	List<MemberTicketVO> getHasTicketMemberAgency(@Param("member_id")String member_id,  @Param("buy_rate")String buy_rate);
	List<MemberTicketVO> getHasTicketMemberParter(@Param("member_id")String member_id,  @Param("buy_rate")String buy_rate);
	void lockTicket(String id);

	int updateSplitTicket(@Param("id")String id, @Param("num")int i);
	
	@Options(useGeneratedKeys = true, keyProperty = "ticket_id")
	void insertSellTicket(@Param("ticketVO")MemberTicketVO ticketVO,@Param("id")String id, @Param("num")int leftNum, @Param("order_id") String order_id, @Param("member_id")String member_id);
	
	int updateSplitTicketOrderEq(@Param("id")String id, @Param("order_id") String order_id, @Param("num")int leftNum);
	
	int updateSplitTicketOrderLt(@Param("id")String id, @Param("order_id")String order_id, @Param("num")int leftNum);

	void insertTiketOutLog(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn") String special_yn, @Param("ticket_state") String ticket_state, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertTiketOutLogRateEq(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn") String special_yn, @Param("ticket_state") String ticket_state, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertCashInLogDynamic(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn") String special_yn, @Param("logTicketVO") LogTicketVO logTicketVO, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertCashInLogDynamicRateEq(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn") String special_yn, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertBuyCashInLogDynamic(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn")String special_yn, @Param("conn_no") String conn_no, @Param("country") String country);

	String getSpecialYn(String member_id);

	void updateMemberSpecialCash(@Param("member_id")String member_id, @Param("num")double num, @Param("rate")String rate);

	void updateSpecialCancelCheck(String member_id);

	void updateMemberCashAndBuyCash(@Param("member_id")String member_id, @Param("order_id")String order_id);

	String getLevelById(String string);

	void insertCashInLogMaster(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("masterAward")AwardVO masterAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("rate")String rate, @Param("conn_no") String conn_no, @Param("country") String country);

	void insertBuyCashInLogMaster(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("masterAward")AwardVO masterAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("rate")String rate, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertBuyCashInLogCompany(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("companyAward")AwardVO companyAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("rate")String rate, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertCashInLogCompany(@Param("type") int type, @Param("member_id") String member_id, @Param("num") String num, @Param("companyAward") AwardVO companyAward, @Param("order_id") String order_id,
			@Param("buy_member_id") String buy_member_id, @Param("rate") String rate, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertCashInLogParter(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("partnerAward")AwardVO masterAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void insertCashInLogStatic(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("staticAward")AwardVO staticAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);
	
	void insertCashInLogPush(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("pushAward")AwardVO pushAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void insertBuyCashInLogStatic(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("staticAward")AwardVO staticAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void deleteMemberTicket(String ticket_id);

	void updateSpecialRecharge(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn")String special_yn, @Param("logTicketVO") LogTicketVO logTicketVO, @Param("country") String country);

	void updateRecharge(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn")String special_yn, @Param("logTicketVO") LogTicketVO logTicketVO, @Param("country") String country);
	
	void updateRechargeRateEq(@Param("type") int type, @Param("member_id")String member_id, @Param("num")int leftNum, @Param("buy_rate")String buy_rate
			, @Param("rate")String rate, @Param("dynamicAward")AwardVO award, @Param("order_id")String order_id, @Param("buy_member_id")String buy_member_id
			, @Param("staticAward")AwardVO staticAward,@Param("special_yn")String special_yn, @Param("country") String country);

	void updateStaticSettle(@Param("member_id")String member_id, @Param("num")String num, @Param("staticAward")AwardVO staticAward, @Param("country") String country);
	
	void updatePushSettle(@Param("member_id")String member_id, @Param("num")String num, @Param("pushAward")AwardVO pushAward, @Param("country") String country);

	void updateMasterSettle(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("masterAward")AwardVO masterAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("rate")String rate, @Param("country") String country);
	
	void updateCompanySettle(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("companyAward")AwardVO companyAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("rate")String rate, @Param("country") String country);

	void updatePartnerSettle(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("partnerAward")AwardVO masterAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("country") String country);

	void updateAwardEarnLogSuccess(String order_id);

	void updateAwardBuyCashLogSuccess(String order_id);

	void addAwardCashAndBuyCash(List<LogEarnVO> earnJoinList);

	List<String> getAwardIds(@Param("order_id")String order_id, @Param("dynamicAward")AwardVO dynamicAward);

	void joinAwardLevelUp(@Param("order_id")String order_id,@Param("vip_level") String vip_level, @Param("joinAward")AwardVO joinAward, @Param("common_level")String common_level);

	void updateAwardEarnLogFailed(String order_id);

	void updateAwardBuyCashLogFailed(String order_id);

	void insertCashInLog5(@Param("member_id")String member_id, @Param("price")String price, @Param("order_id") String order_id, @Param("pay_type")String pay_type);

	void insertBuyCashInLog(@Param("member_id")String member_id, @Param("order_id") String order_id,@Param("buy_cash")  String buy_cash);

	void deleteMemberTicketBuy(String order_id);

	void backMemberTicketBuy(String order_id);

	void insertTiketOutLogSystem(@Param("member_id")int i, @Param("num")int leftNum, @Param("buy_rate")String buy_rate, @Param("pay_type")String pay_type,@Param("type") int type
			, @Param("buy_member_id")String member_id, @Param("order_id") String order_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void updateTicketLogSellSuccess(String order_id);
	
	void updateTicketLogSellSuccess2(String order_id);

	void updateTicketLogSellFailed(String order_id);
	
	void updateTicketLogSellFailed2(String order_id);

	List<MemberTicketVO> getHasTicketMemberBuy(String member_id);

	void insertTicketOutLog2(@Param("member_id")String member_id, @Param("order_id")String order_id, @Param("num") int leftNum, @Param("ticket_state")String ticket_state, @Param("rate")String rate);

	List<LogEarnVO> getAwardEarnList(@Param("order_id") String order_id,@Param("award_id")  String award_id);

	void addAwardCashAndBuyCashOne(LogEarnVO logEarnVO);

	void updateSpecialCash(LogEarnVO logEarnVO);

	void updateSpecialCashFailed(LogEarnVO logEarnVO);

	void joinAwardLevelUpNow(@Param("member_id") String member_id, @Param("vip_level") String vip_level, @Param("common_level") String common_level);

	String getStaticAwardFitMember(@Param("member_id") String member_id, @Param("vip_level") String vip_level);

	String getMasterAwardFitMember(@Param("member_id") String member_id, @Param("master_level") String master_level, @Param("partner_level") String partner_level);

	String getCompanyAwardFitMember(@Param("member_id") String member_id, @Param("partner_level") String partner_level);
	
	String getDynamicAwardFitMember(@Param("member_id") String member_id, @Param("vip_level") String vip_level);

	int lockMemberTicket(String id);

	void unLockMemberTicket(String id);

	List<MemberTicketVO> getLockTicketByOrder(String order_id);

	void deleteTicketById(String id);

	List<LogTicketVO> getBackTickets(String order_id);

	void insertLogTicketIn5(LogTicketVO logTicketVO);

	void insertLogTicketInBack5(@Param("memberTicketVO") MemberTicketVO memberTicketVO, @Param("order_id") String order_id);

	MemberVO getAreaAgencyByCity(@Param("member_id") String member_id, @Param("area_level") String area_level);

	List<MemberTicketVO> getHasTicketMemberArea(@Param("member_id") String member_id, @Param("buy_rate") String buy_rate);
	
	List<MemberTicketVO> getHasTicketMemberAreaLt(@Param("member_id") String member_id, @Param("buy_rate") String buy_rate);

	void insertCashInLogArea(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("areaAward")AwardVO areaAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void updateAreaSettle(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("areaAward")AwardVO areaAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("country") String country);

	MemberVO getCityAgencyByCity(@Param("member_id") String member_id, @Param("city_level") String city_level);

	void insertCashInLogCity(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("cityAward")AwardVO cityAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("conn_no") String conn_no, @Param("country") String country);

	void updateCitySettle(@Param("type") int type, @Param("member_id")String member_id, @Param("num")String num, @Param("cityAward")AwardVO cityAward, @Param("order_id")String order_id,
			@Param("buy_member_id")String buy_member_id, @Param("country") String country);

	List<LogTicketVO> getBackTicketsUse(String order_id);

	void insertLogTicketInUse5(LogTicketVO logTicketVO);

	double getMinRate();

	List<MemberTicketVO> getBackLockTicketByOrder(String order_id);

	void insertBackTicket(@Param("ticketVO")MemberTicketVO ticketVO,@Param("id")String id, @Param("num")int leftNum, @Param("order_id") String order_id, @Param("member_id")String member_id);

	void backTicketById(String id);

	void insertLogTicketInBack5Lt(@Param("memberTicketVO") MemberTicketVO memberTicketVO, @Param("leftNum") int leftNum, @Param("order_id") String order_id);

	int addJoinAwardCash(@Param("member_id") String member_id, @Param("join_cash") String join_cash, @Param("country") String country);

	int checkParentLevelAwardFit(@Param("parentLevel") String parentLevel, @Param("level") String level);

	String getPushAwardFitMember(@Param("member_id") String member_id, @Param("vip_level") String vip_level);

	List<MemberTicketVO> getBackMemberTickets(String order_id);

	int getAddressNum(String member_id);

	String getCountryByOrder(String order_id);

}
